aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/fund/[id]/sweep
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-08-10 18:53:09 -0700
committerAdam Soltys <[email protected]>2025-08-10 18:53:09 -0700
commit633e3a3d94777440f07ed00a88abc1ac388bb2f0 (patch)
treec26fe53768fdd538eac16364a68a2ed4f51b413a /src/routes/(app)/fund/[id]/sweep
parent5f2c4e41c181e52cdf822b1c5ee0e7ce99b94fa3 (diff)
downloadcoinos-ui-633e3a3d94777440f07ed00a88abc1ac388bb2f0.tar.gz
coinos-ui-633e3a3d94777440f07ed00a88abc1ac388bb2f0.zip
authorizations
Diffstat (limited to 'src/routes/(app)/fund/[id]/sweep')
-rw-r--r--src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts
index 47dfdaab..78df3461 100644
--- a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts
+++ b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts
@@ -9,15 +9,16 @@ export async function load({ cookies, request, params, parent }) {
let [amount, currency] = params.amount.split("/");
if (!currency) currency = user?.currency;
+ if (currency) currency = currency.toUpperCase();
const rates = await getRates();
- const rate = rates[currency?.toUpperCase() || "USD"];
+ const rate = rates[currency || "USD"];
if (currency && !rate) error(500, "Invalid currency symbol");
if (!amount) {
const balance = await get(`/fund/${id}`);
- amount = balance.amount;
+ amount = balance.authorization || balance.amount;
} else if (currency) {
- amount = (amount * sats) / rate;
+ amount = Math.round((amount * sats) / rate);
}
const username = randomName() + Math.floor(Math.random() * 99) + 1;